The placeMarketOrder method places a market order inline without the need for creating a separate Order object.
var placeMarketOrder(symbol, quantity, actionType, tifType);
symbol
Symbol string for which to place the order.
quantity
Floating or numeric order quantity.
actionType
One of the order action types such as buy or sell.
tifType
One of the time-in-force types such as Day or Good-till-Canceled.
This method returns true if order was placed successfully, false otherwise.
The following example demonstrates the use of placeMarketOrder method.
function init()
{
//add "Default Trading Size" parameter
addParameter("Default Trading Size", "This is the default trading size volume", 1000);
}
function start()
{
//retrieve short positions for all symbols
var account = getAccount();
var placeLongOrder = false;
//determine whether a long order needs to be placed
..
..
..
if(placeLongOrder)
{
var rc = account.placeMarketOrder(getSymbol(),
parseFloat(getParameter("Default Trading Size")),
ACTIONTYPE_BUY,
TIFTYPE_DAY);
}
}
init(), start(), addParameter(), getParameter()
Copyright © 2006-2009 ActiveTick LLC